package com.litesuits.sdk.listener;

import android.app.Activity;
import com.litesuits.http.listener.HttpListener;

public abstract class AbsActivityHttpListener<T> extends HttpListener<T> {
    protected Activity linkedActivity;

    public AbsActivityHttpListener(Activity linkedActivity) {
        this.linkedActivity = linkedActivity;
    }

    public AbsActivityHttpListener(Activity linkedActivity, boolean runOnUiThread, boolean readingNotify, boolean uploadingNotify) {
        super(runOnUiThread,readingNotify,uploadingNotify);
        this.linkedActivity = linkedActivity;
    }

    @Override
    public boolean disableListener() {
        return isActivityDestroy();
    }

    public boolean isActivityDestroy(){
        return linkedActivity == null || linkedActivity.isFinishing();
    }
}